<<<<<<< HEAD
package com.wyz.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wyz.entity.CourseTableEntity;
import com.wyz.entity.ScoreEntity;
import com.wyz.entity.StudentEntity;
import com.wyz.mapper.CourseTableMapper;
import com.wyz.mapper.CourseTableVOMapper;
import com.wyz.mapper.ScoreMapper;
import com.wyz.vo.CourseTableVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author wk
 * @desc
 * @date 2024/12/25 14:45
 */
@Service
public class CourseTableService {
    @Resource
    private CourseTableMapper courseTableMapper;
    @Resource
    private CourseTableVOMapper courseTableVOMapper;
    @Resource
    private ScoreMapper scoreMapper;
    public List<CourseTableVO> queryAllCourseTable() {
        return courseTableVOMapper.queryAllCourseTable();
    }

    public boolean deleteCourseTable(Integer coursetableId) {

        int a = scoreMapper.deleteCoursetableId(coursetableId);
        int b = courseTableMapper.deleteById(coursetableId);
        return a>0 && b>0;

    }

    public boolean addCourseTable(CourseTableEntity courseTableEntity) {
        courseTableMapper.insertCourseTable(courseTableEntity);
        ScoreEntity scoreEntity = new ScoreEntity();
        scoreEntity.setCoursetableId(courseTableEntity.getCoursetableId());
        return scoreMapper.insertScore(scoreEntity)>0;

    }
    public List<CourseTableVO> queryCourseTableByStudentId(Integer studentId) {
        return courseTableVOMapper.queryCourseTableByStudentId(studentId);
    }

}
=======
package com.wyz.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wyz.entity.CourseTableEntity;
import com.wyz.entity.StudentEntity;
import com.wyz.mapper.CourseTableMapper;
import com.wyz.mapper.CourseTableVOMapper;
import com.wyz.vo.CourseTableVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author wk
 * @desc
 * @date 2024/12/25 14:45
 */
@Service
public class CourseTableService {
    @Resource
    private CourseTableMapper courseTableMapper;
    @Resource
    private CourseTableVOMapper courseTableVOMapper;
    public List<CourseTableVO> queryAllCourseTable() {
        return courseTableVOMapper.queryAllCourseTable();
    }

    public boolean deleteCourseTable(Integer coursetableId) {
        return courseTableMapper.deleteById(coursetableId) > 0;
    }


    public boolean addCourseTable(CourseTableEntity courseTableEntity) {
        return courseTableMapper.insert(courseTableEntity) > 0;
    }
}
>>>>>>> be516e15a35375b38cf973b1ce88c92dd1ceba03
